<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTablePayCallbackLogs extends Migration
{
    private $table = 'pay_callback_logs';

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create($this->table, function (Blueprint $table) {
            $table->id();
            $table->unsignedTinyInteger('payChannel')->default(0);
            $table->string('serialNo', 32)->index('idx_serialNo');
            $table->text('requestData');
            $table->string('responseData', 255)->default('');
            $table->integer("createdAt")->default(0)->comment("创建时间");
            $table->collation = 'utf8mb4_general_ci';
        });

        $prefix = config('other.DB_PREFIX', '');
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `{$prefix}$this->table` COMMENT = '支付回调日志'"); //表注释
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists($this->table);
    }
}
